package com.hdaccp.foodsales.controller;
import com.hdaccp.foodsales.dao.shangpinDao;
import com.hdaccp.foodsales.dao.xiaoshouxxDao;
import com.hdaccp.foodsales.entity.Jinhuoxx;
import com.hdaccp.foodsales.entity.Xiaoshou;
import com.hdaccp.foodsales.entity.Xiaoshouxx;
import com.hdaccp.foodsales.pojo.diquBean;
import com.hdaccp.foodsales.pojo.sptypeBean;
import com.hdaccp.foodsales.service.jinhuoxxService;
import com.hdaccp.foodsales.service.xiaoshouService;
import com.hdaccp.foodsales.service.xiaoshouxxService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/xiaoshouxx")
@Scope("prototype")
public class xiaoshouxxController {
    @Autowired
    private xiaoshouxxService xiaoshouxxService;
    @Autowired
    private xiaoshouxxDao xiaoshouxxDao;


    @RequestMapping("/cx")
    @ResponseBody
    public List<Xiaoshouxx> cx(int dh){
        return xiaoshouxxService.getAll(dh);
    }

    @RequestMapping("/addxx")
    @ResponseBody
    public int addxx(Xiaoshouxx xiaoshouxx){
        return xiaoshouxxService.addxx(xiaoshouxx);
    }

    @RequestMapping("/querydiqu")
    @ResponseBody
    public Map<String,List<diquBean>> querydiqu(){
        Map<String,List<diquBean>> map = new HashMap<>() ;
        List<diquBean> list =xiaoshouxxDao.queryxl();
        map.put("xl",list);
        return map;
    }


}
